import { http } from '@/utils/https'
import type { AlarmData } from '@/types/alarm'

/**
 * 根据设备号获取报警列表
 */
export const getAlarmListApi = (deviceNum: string) => {
  return http<AlarmData>({
    url: `/alarm/list/${deviceNum}`,
    method: 'POST',
  })
}
/**
 * 将当前设备下的所有警报设为已读
 */
export const setAlarmReadApi = (deviceNum: string) => {
  return http({
    url: `/alarm/setAllRead/${deviceNum}`,
    method: 'POST',
  })
}

/**
 * 根据alarmId将警报设为已读
 */
export const setReadFlag = (alarmId: boolean) => {
  return http({
    url: `/alarm/setRead/${alarmId}`,
    method: 'POST',
  })
}
/**
 * 获取警报详情
 */ 
export const getAlarmDetailApi = (alarmId: number) => {
  return http({
    url: `/alarm/detail/${alarmId}`,
    method: 'POST',
  })
}

/**
 * 将所有警报设为已读
 */
export const setAllReadApi = (deviceNum:string) => {
  return http({
    url: `/alarm/setAllRead/${deviceNum}`,
    method: 'POST',
  })
}